package com.hhkj.study.api.user.common.handler;

import com.hhkj.study.api.user.model.res.ApiCustomerUserBaseRes;
import com.hhkj.study.api.user.model.res.ApiCustomerUserLoginRes;
import com.ruoyi.framework.login.api.ApiSessionHolder;
import lombok.experimental.UtilityClass;

/**
 * AccountSessionHandler
 *
 * @author SERVER
 * @since 2024/4/1 11:10
 */
@UtilityClass
public class AccountSessionHandler {

    /**
     * 获取TTL中的LoginStudent
     *
     * @return 登录学员信息
     */
    public ApiCustomerUserBaseRes getCurrentAccount() {
        Object sessionObj = ApiSessionHolder.getSessionObj();
        if (sessionObj instanceof ApiCustomerUserLoginRes) {
            return (ApiCustomerUserBaseRes) sessionObj;
        }
        return null;
    }



    /**
     * 清除
     */
    public void clear() {
        ApiSessionHolder.clear();
    }
}
